﻿namespace Frameworks
{
    public static class EventProxy
    {
        private static EventDispatcher _dispatcher;

        static EventProxy()
        {
            _dispatcher = new EventDispatcher();
        }

        public static bool AddEventListener(object eventType, EventListenerDelegate callback)
        {
            return _dispatcher.AddEventListener(eventType, callback);
        }

        public static bool RemoveEventListener(object eventType)
        {
            return _dispatcher.RemoveEventListener(eventType);
        }

        public static bool RemoveEventListener(object eventType, EventListenerDelegate callback)
        {
            return _dispatcher.RemoveEventListener(eventType, callback);
        }

        public static void RemoveAllEventListeners()
        {
            _dispatcher.RemoveAll();
        }

        public static bool BroadcastEvent(EventData eventData)
        {
            return _dispatcher.BroadcastEvent(eventData);
        }

        public static bool BroadcastEvent(object eventType, object data)
        {
            EventData eventData = new EventData(eventType, data);
            return _dispatcher.BroadcastEvent(eventType, eventData);
        }

        public static bool BroadcastEvent(object eventType, EventData eventData = null)
        {
            return _dispatcher.BroadcastEvent(eventType, eventData);
        }

        public static bool HasEventListener(object type)
        {
            return _dispatcher.HasEventListener(type);
        }

        public static bool HasEventListener(object type, EventListenerDelegate callback)
        {
            return _dispatcher.HasEventListener(type, callback);
        }

        public static void Destroy()
        {
            _dispatcher.Destory();
        }
    }
}
